package com.sromku.simple.fb.example.views;

import java.util.List;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.hal.model.Departement;
import com.sromku.simple.fb.example.R;
import com.sromku.simple.fb.example.utils.MyUser;

public class ListLeftMenuAdapter extends ArrayAdapter<String> {
 
    private Integer[] tab_images_pour_la_liste = {
      R.drawable.ic_launcher, R.drawable.ic_launcher,
      R.drawable.ic_launcher,
      R.drawable.ic_launcher,
      R.drawable.ic_launcher,
      R.drawable.ic_launcher,
      R.drawable.ic_launcher,
      R.drawable.ic_launcher,
      R.drawable.ic_launcher };
 
    @SuppressLint("ViewHolder")
	@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater)
          getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
        View rowView = inflater.inflate(R.layout.listview_left_menu, parent, false);
 
        TextView textView = (TextView) rowView.findViewById(R.id.label);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.ic_listLeftMenu);
 
        textView.setText(getItem(position));
 
        if(convertView == null )
          imageView.setImageResource(tab_images_pour_la_liste[position]);
        else
          rowView = (View)convertView;
 
        return rowView;
    }
 
    public ListLeftMenuAdapter(Context context, String[] values) {
        super(context, R.layout.listview_left_menu, values);
    }
}